<?php
namespace App\Admin\Services;

class Live
{


    public static function getUrl($time=''){
        $res = [];
        if(!$time) $time = time();
        $time +=config('livestudio.expire');
        $push_sstring = '/' . config('livestudio.app_name'). '/' . config('livestudio.stream_name') . '-' . $time . '-0-0-' . config('livestudio.push_key');
        $live_sstring = '/' . config('livestudio.app_name') . '/' . config('livestudio.stream_name'). '.m3u8-' . $time . '-0-0-' . config('livestudio.live_key');
        $push_md5 = md5($push_sstring);
        $live_md5 = md5($live_sstring);
        $res['push_url'] = config('livestudio.push_domain'). '/' .  config('livestudio.app_name').'/'.config('livestudio.stream_name') . '?auth_key=' . $time . '-0-0-' . $push_md5;
        $res['live_url'] = config('livestudio.live_domain') . '/' . config('livestudio.app_name') . '/' .config('livestudio.stream_name') . '.m3u8?auth_key=' . $time . '-0-0-' . $live_md5;
        return  [$res];
    }
}